/*
* by mingjin
 */
var canvansbar = document.getElementById('barGraph');
var height = document.body.clientHeight*0.8;
var width = document.body.clientWidth*0.93;
canvansbar.style.height = height + "px";
canvansbar.style.width = width + "px";
//柱状图
var myChart = echarts.init(canvansbar);
var colors = ['#5793f3', '#d14a61', '#675bba'];
myChart.setOption({
	color: colors,
    title: {
        text: '订单类型统计',
        x:'center',
        
    },
    tooltip: {
        trigger: 'axis',
        axisPointer : {            // 坐标轴指示器，坐标轴触发有效
            type : 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
        }
    },
    legend: {
    	left: 'left',
        data:['订单数','运载人数','价格总计']
    },
    xAxis: {
        data: []
    },
    yAxis: [
            {
                type: 'value',
                name: '订单数',
                position: 'left',
                axisLine: {
                    lineStyle: {
                        color: colors[0]
                    }
                },
                axisLabel: {
                    formatter: '{value}单'
                }
            },
            {
                type: 'value',
                name: '运载人数',
                position: 'right',
                axisLine: {
                    lineStyle: {
                        color: colors[1]
                    }
                },
                axisLabel: {
                    formatter: '{value}人'
                }
            },
            {
                type: 'value',
                name: '价格总计',
                position: 'right',
                offset: 50,
                axisLine: {
                    lineStyle: {
                        color: colors[2]
                    }
                },
                axisLabel: {
                    formatter: '{value}元 '
                }
            }
        ],
    series: [{
        name:'订单数',
        type:'bar',
        data:[],
        yAxisIndex: 0
    },
    {
        name:'运载人数',
        type:'bar',
        data:[],
        yAxisIndex: 1
    },
    {
        name:'价格总计',
        type:'bar',
        data:[],
        yAxisIndex: 2
    }    
      
    ]
});
//饼状图
var canvanspie = document.getElementById('pieGraph');
canvanspie.style.height = height + "px";
canvanspie.style.width = width + "px";
var pieChart = echarts.init(canvanspie);
pieChart.setOption({
	title : {
        text: '订单类型统计',
        x:'center'
    },
    tooltip : {
        trigger: 'item',
        formatter: "{a} <br/>{b} : {c} ({d}%)"
    },
    legend: {
        orient: 'vertical',
        left: 'left',
        data: []
    },
    calculable : true,
    series : [
        {
              name:'订单数',
              type:'pie',
              selectedMode: 'single',
              radius: [0, '30%'],

              label: {
                 normal: {
                    position: 'inner'
                   }
                  },
              labelLine: {
                    normal: {
                     show: false
                   }
                  },
              data:[]
           },
         {
           name:'运载人数',
           type:'pie',
            radius: ['40%', '55%'],

            data:[]
          },
          {
              name:'价格总计',
              type:'pie',
               radius: ['60%', '75%'],

               data:[]
           }
    ]
});
//折线图
var canvansline = document.getElementById('lineGraph');
canvansline.style.height = height + "px";
canvansline.style.width = width + "px";
var lineChart = echarts.init(canvansline);
lineChart.setOption({
	    color: colors,
	    title: {
		    text: '订单类型统计',
	        x:'center'    
	    },
	    tooltip: {
	        trigger: 'axis'
	    },
	    grid: {
	        right: '20%'
	    },
	    legend: {
	    	left: 'left',
	        data:['订单数','运载人数','价格总计']
	    },
	    
	    xAxis:  {
	        type: 'category',
	        axisTick: {
                alignWithLabel: true
            },
	        data: []
	    },
	    yAxis: [
	            {
	                type: 'value',
	                name: '订单数',
	                position: 'left',
	                axisLine: {
	                    lineStyle: {
	                        color: colors[0]
	                    }
	                },
	                axisLabel: {
	                    formatter: '{value}单'
	                }
	            },
	            {
	                type: 'value',
	                name: '运载人数',
	                position: 'right',
	                axisLine: {
	                    lineStyle: {
	                        color: colors[1]
	                    }
	                },
	                axisLabel: {
	                    formatter: '{value}人'
	                }
	            },
	            {
	                type: 'value',
	                name: '价格总计',
	                position: 'right',
	                offset: 50,
	                axisLine: {
	                    lineStyle: {
	                        color: colors[2]
	                    }
	                },
	                axisLabel: {
	                    formatter: '{value}元 '
	                }
	            }
	        ],
	    series: [{
	        name:'订单数',
	        type:'line',
	        data:[],
	        yAxisIndex: 0
	    },
	    {
	        name:'运载人数',
	        type:'line',
	        data:[],
	        yAxisIndex: 1
	    },
	    {
	        name:'价格总计',
	        type:'line',
	        data:[],
	        yAxisIndex: 2
	    }    
	      
	    ]
});